package com.roc.template.mongo.base;

import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseServiceImpl<T> implements BaseService<T> {
    private BaseDao baseDao;

    public void setBaseDao(BaseDao<T> baseDao) {
        this.baseDao = baseDao;
    }
    @Override
    public T save(T t) {
        return (T) baseDao.save(t);
    }

    @Override
    public T insert(T t) {
        return (T) baseDao.insert(t);
    }

    @Override
    public int batchInsert(List<T> t) {
        return baseDao.batchInsert(t);
    }

    @Override
    public long update(String id, T entity) {
        return baseDao.update(id,entity);
    }

    @Override
    public T queryById(String id) {
        return (T) baseDao.queryById(id);
    }

    @Override
    public long delete(String id) {
        return baseDao.delete(id);
    }

    @Override
    public long batchDelete(List<String> ids) {
        return baseDao.batchDelete(ids);
    }

    @Override
    public List<T> queryAll() {
        return baseDao.queryAll();
    }
}
